package cn.itcast.service.impl;

import cn.itcast.dao.ChangeDao;
import cn.itcast.dao.ChangeListDao;
import cn.itcast.dao.impl.ChangeDaoImpl;
import cn.itcast.dao.impl.ChangeListDaoImpl;
import cn.itcast.domain.Change;
import cn.itcast.service.ChangeService;

import java.util.List;

public class ChangeServiceImpl implements ChangeService {
    ChangeDao dao=new ChangeDaoImpl();
    ChangeListDao dao1=new ChangeListDaoImpl();
    @Override
    public List<Change> findAll() {
        return dao.findAll();
    }

    @Override
    public Change findChangeById(String id) {
        return dao.findChangeById(Integer.parseInt(id));
    }

    @Override
    public void updateChangeInfob(Change change) {
        int id = change.getId();
        String info_b = change.getInfo_b();
        dao.updateChangeInfob(change);
        dao1.updateChangeInfob(info_b,id);
    }
}
